]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ScreenShield: prepare the dialog when the user starts dragging
authorGiovanni Campagna <gcampagna@src.gnome.org>
Tue, 7 Aug 2012 16:07:07 +0000 (18:07 +0200)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Mon, 13 Aug 2012 15:59:19 +0000 (17:59 +0200)
This way if the user drags long enough it will see the dialog
below the curtain, and it will appear as it was always there.

https://bugzilla.gnome.org/show_bug.cgi?id=681143

js/ui/screenShield.js

index 1b53276b2e58b35a68a1408d32b849762bef7d8c..7601340c59ffd0840230bfa49fa0956644621611 100644 (file)
@@ -352,7 +352,8 @@ const ScreenShield = new Lang.Class({
 
     _onLockScreenKeyRelease: function(actor, event) {
         if (event.get_key_symbol() == Clutter.KEY_Escape) {
-            this._showUnlockDialog(true);
+            this._ensureUnlockDialog();
+            this._hideLockScreen(true);
             return true;
         }
 
@@ -374,12 +375,13 @@ const ScreenShield = new Lang.Class({
 
     _onDragBegin: function() {
         Tweener.removeTweens(this._lockScreenGroup);
+        this._ensureUnlockDialog();
     },
 
     _onDragEnd: function(action, actor, eventX, eventY, modifiers) {
         if (this._lockScreenGroup.y < -(ARROW_DRAG_TRESHOLD * global.stage.height)) {
             // Complete motion automatically
-            this._showUnlockDialog(true);
+            this._hideLockScreen(true);
         } else {
             // restore the lock screen to its original place
             // try to use the same speed as the normal animation
@@ -394,6 +396,14 @@ const ScreenShield = new Lang.Class({
                                    this.fixed_position_set = false;
                                }
                              });
+
+            // If we have a unlock dialog, cancel it
+            if (this._dialog) {
+                this._dialog.cancel();
+                if (!this._keepDialog) {
+                    this._dialog = null;
+                }
+            }
         }
     },
 
@@ -428,10 +438,11 @@ const ScreenShield = new Lang.Class({
 
     showDialog: function() {
         this.lock(true);
-        this._showUnlockDialog(false);
+        this._ensureUnlockDialog();
+        this._hideLockScreen(false);
     },
 
-    _showUnlockDialog: function(animate) {
+    _hideLockScreen: function(animate) {
         if (animate) {
             // Tween the lock screen out of screen
             // try to use the same speed regardless of original position
@@ -442,12 +453,14 @@ const ScreenShield = new Lang.Class({
                              { y: -h,
                                time: time,
                                transition: 'linear',
-                               onComplete: Lang.bind(this, this._hideLockScreen),
+                               onComplete: function() { this.hide(); }
                              });
         } else {
-            this._hideLockScreen();
+            this._lockScreenGroup.hide();
         }
+    },
 
+    _ensureUnlockDialog: function() {
         if (!this._dialog) {
             [this._dialog, this._keepDialog] = Main.sessionMode.createUnlockDialog(this._lockDialogGroup);
             if (!this._dialog) {
@@ -488,14 +501,8 @@ const ScreenShield = new Lang.Class({
         this.unlock();
     },
 
-    _hideLockScreen: function() {
-        this._arrow.hide();
-        this._lockScreenGroup.hide();
-    },
-
     _resetLockScreen: function(animate) {
         this._lockScreenGroup.show();
-        this._arrow.show();
 
         if (animate) {
             this._lockScreenGroup.y = -global.screen_height;